package com.tianyu.inspection.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tianyu.inspection.common.Constants;
import com.tianyu.inspection.common.annotation.Permission;
import com.tianyu.inspection.entity.GeneralFacilities;
import com.tianyu.inspection.entity.model.QueryMo;
import com.tianyu.inspection.entity.vo.Ro;
import com.tianyu.inspection.service.api.IGeneralFacilitiesService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**********************************
 * @Author YSW
 * @Description 通用设施-场站 接口
 * @Date 2021/1/15 - 18:12
 **********************************/

@RestController
@RequestMapping("/api/2.0/pipelineStation")
public class PipelineStationController {

    @Resource
    private IGeneralFacilitiesService generalFacilitiesService;

    @GetMapping(value = "/list")
    @Permission(value = 4,tags = Constants.API_PATROL)
    public Ro<IPage<GeneralFacilities>> getPageList(@RequestHeader("u-projectId") Integer projectId){
        QueryMo queryMo = new QueryMo();
        queryMo.put("pageSize",-1);
        queryMo.put("generalFacilitiesTypeId",2);
        Ro<IPage<GeneralFacilities>> ro = new Ro<>();
        queryMo.build(GeneralFacilities.class,projectId);
        return ro.setContent(generalFacilitiesService.searchListPage(queryMo));
    }
}
